﻿using DatabaseAccess;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Liguo.Administration
{
    public partial class AddNewUser : System.Web.UI.Page
    {
        SqlIt sql = new SqlIt();
        //DataSet类承接查询结果
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void submit_C(object sender, EventArgs e)
        {
            string salt = Utilities.GetSalt();
            string username = UserName.Text.Trim();
            string mailbox = MailBox.Text.Trim();
            string password = Password1.Value.ToString();
            //Response.Write(username+password + mailbox+salt);
            if (username.Length == 0 || mailbox.Length == 0 || password.Length == 0) 
            {
                Response.Write("<script>alert('无效输入！')</script>");
                return;
            }
            string pw = Utilities.GetMD5(password+salt);
            Dictionary<string, string> info = new Dictionary<string, string>();
            info["UserName"] = username;
            info["MailBox"] = mailbox;
            info["Password"] = pw;
            info["Salt"] = salt;
            info["Status"] = "1";
            info["Score"] = "0";
            info["Reputation"] = "0";
            sql.AddMess("UserInfo", info);
            Response.Write("<script>alert('添加成功！')</script>");
            return;

           // 
        }
    }
}